# -*- coding: utf-8 -*-

from projekty.models import Projekt
from django import template
from django.template import Context
from django.template import Library
from django.template import Node
from widgets.forms import *
register = Library()

class WidgetProjectsNode(Node):

    def __init__(self):
        pass

    def render(self, context):
        projekty = Projekt.objects.filter(data_ukonczenia=None)#jeszcze nie skończony projekt
        title = 'Projekty'

        t = template.loader.get_template('widgets/projekty.html')

        return t.render(Context({'projekty': projekty, 'title':title, 'MEDIA_URL':context['MEDIA_URL'], }, autoescape=context.autoescape))


@register.tag
def widget_projects(parser, token):
    return WidgetProjectsNode()
